#!/bin/bash

export LM_LICENSE_FILE=7500@reddish
PGI_HOME="/usr/local/pgi_64/linux86-64/7.0-7"
MPICH_HOME="/usr/local/mpi/mpich/64Bit/1.2.7/pgi-6.0"

export PATH="${PGI_HOME}/bin:${PATH}"

TEST_SRC="test_main.c test_c_dnax.c test_c_tpi.c test_pthreads.c"

LIB_SRC="../src/TPI_pthreads.c ../src/TPI_Walltime.c ../src/TPI_Concurrency.c"

LIB_OBJ="TPI_pthreads.o TPI_Walltime.o TPI_Concurrency.o"

#-----------------------------------------------------------------------

pgcc	-O4 -c	\
	-I../include ${LIB_SRC} -lpthread

pgcc	-O4	\
	-o test_tpi.pgi.exe	\
	-I../include ${TEST_SRC} ${LIB_OBJ} -lpthread

pgCC	-O4	\
	-o test_tpi_cpp.pgi.exe	\
	-I../include test_tpi.cpp ${LIB_OBJ} -lpthread

#-----------------------------------------------------------------------
# Enable PGI-MPI installation to accept as large a message as possible, 200 Mb

# export P4_GLOBMEMSIZE="268435456"

export PATH="${MPICH_HOME}/bin:${PGI_HOME}/bin:${PATH}"

mpicc	-c99	\
	-O4	\
	-o test_sum.mpi.pgi.exe	\
	-I../include -DTEST_WITH_MPI test_mpi_sum.c ${LIB_OBJ} -lpthread

